//
//  MQEmoticonPopView.swift
//  SinaWeiBo
//
//  Created by 毛强 on 16/2/5.
//  Copyright © 2016年 itheima. All rights reserved.
//

import UIKit

class MQEmoticonPopView: UIView {

    @IBOutlet weak var emoticonBtn: UIButton!
    class func initPopView() -> MQEmoticonPopView{
        return NSBundle.mainBundle().loadNibNamed("MQEmoticonPopView", owner: nil, options: nil).first as! MQEmoticonPopView
    }
    
    func setEmoticonBtnImageAndTitle(emoticon:MQEmoticon){
        if emoticon.type == "0"{
            let imageName = "\(emoticon.path!)/\(emoticon.png!)"
            emoticonBtn.setImage(UIImage(named: imageName, inBundle: MQEmoticonTools.shareTools.emoticonBundle, compatibleWithTraitCollection: nil), forState: UIControlState.Normal)
        }else if emoticon.type == "1"{
            emoticonBtn.setTitle((emoticon.code! as NSString).emoji(), forState: UIControlState.Normal)
        }
    }
    
}
